package com.moma.cxftest;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import javax.jws.WebService;

@WebService(endpointInterface="com.moma.cxftest.HelloWorld", serviceName="HelloWorld")
public class HelloWorldImpl implements HelloWorld {
	Map<Integer, User> users = new LinkedHashMap<Integer, User>();

	public String sayHi(String text) {
		System.out.println("sayHi called...");
		return "Hello " + text;
	}

//	public Document getADocument() {
//		DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
//		DocumentBuilder db = null;
//		try {
//			db = dbfac.newDocumentBuilder();
//		} catch (ParserConfigurationException e) {
//			e.printStackTrace();
//		}
//		Document doc = db.newDocument();
//	}
	public int add(int a, int b){
		return a + b;
	}

	public String[] sayHiToUserList(List<User> userList) {
		String[] result = new String[userList.size()];
		int i = 0;
		for (User u : userList){
			result[i] = "Hello " + u.getName();
			i++;
		}
		return result;
	}
}
